﻿Public Class TMP_VentaSeguro

    Implements IDisposable
    Dim szSQL As String
    Public _RutContratante As Integer
    Public _DVContratante As String
    Public _FechaNacimientoAsegurado As String
    Public _iAnno As Integer
    Public _NombreContratante As String
    Public _IDSeguro As Integer
    Public _NroCarga As Integer
    Public _Plan As String

    Public _Rut_vendedor As String
    Public _DVRut_vendedor As String
    Public _Nombre_Vendedor As String
    Public _CUI As String
    Public _Rut_Asegurado As String
    Public _DVRut_Asegurador As String
    Public _Nombre_Asegurado As String
    Public _ApellidoPaterno_Asegurado As String
    Public _ApellidoMaterno_Asegurado As String
    Public _FechaNacimiento_Asegurado As String
    Public _Sexo As Integer
    Public _Calle As String
    Public _NroCalle As String
    Public _NroDepartamento As String
    Public _VillaPoblacion As String
    Public _Telefono As String
    Public _Celular As String
    Public _Correo As String
    Public _CodCiudad As String
    Public _CodComuna As String
    Public _CodBanco As String
    Public _CodMedioPago As String
    Public _TipoTarjeta As String
    Public _NroMedioPago As String
    Public _FechaPrimerCargo As String
    Public _MedioPagoBCH As String




    Public Sub Get_TMP_VentaSeguro(ByVal rp As NetResponse.MsSqlServer)
        Dim exec As New DotNetDAL.SqlServerTransaccion()
        'rp.Query = "Select * from TMP_VentaSeguro Where Id_seguro = " & _IDSeguro.ToString

        rp.StoredProcedure = "sp_Get_TMP_VentaSeguro"

        rp.AddParametro(_IDSeguro.ToString)

        exec.Executedataset(rp)
        exec.Dispose()

    End Sub

    'Public Sub Get_TMP_VentaSeguro_NroCarga(ByVal rp As NetResponse.MsSqlServer)
    '    Dim exec As New DotNetDAL.SqlServerTransaccion()
    '    szSQL = szSQL & " Update TMP_VentaSeguro "
    '    szSQL = szSQL & " Set  CargasS = " & _NroCarga.ToString
    '    szSQL = szSQL & " Where Id_seguro = " & _IDSeguro.ToString
    '    rp.Query = szSQL

    '    exec.Executedataset(rp, rp.Query)
    '    exec.Dispose()

    'End Sub

    Public Sub Get_IDSeguro_TMP(ByVal rp As NetResponse.MsSqlServer)
        Dim exec As New DotNetDAL.SqlServerTransaccion()
        rp.StoredProcedure = "sp_TMP_DatosSimulacion"

        rp.AddParametro(_RutContratante)
        rp.AddParametro(_DVContratante)
        rp.AddParametro(_NombreContratante)
        rp.AddParametro(_FechaNacimientoAsegurado)
        rp.AddParametro(_iAnno)

        exec.Executedataset(rp)
        exec.Commit()

        exec.Dispose()

    End Sub
    Public Sub UPD_NroCarga_TMP(ByVal rp As NetResponse.MsSqlServer)
        Dim exec As New DotNetDAL.SqlServerTransaccion()
        rp.StoredProcedure = "sp_TMP_NroCarga"

        rp.AddParametro(_IDSeguro)
        rp.AddParametro(_NroCarga)
        rp.AddParametro(_Plan)
        
        exec.ExecuteNonQuery(rp)
        exec.Commit()

        exec.Dispose()

    End Sub

    Public Sub UPD_IngresoVenta(ByVal rp As NetResponse.MsSqlServer)
        Dim exec As New DotNetDAL.SqlServerTransaccion()
        rp.StoredProcedure = "sp_TMP_IngresoDatosVenta"


        rp.AddParametro(_IDSeguro)
        rp.AddParametro(_Rut_vendedor)
        rp.AddParametro(_DVRut_vendedor)
        rp.AddParametro(_Nombre_Vendedor)
        rp.AddParametro(_CUI)
        rp.AddParametro(_Rut_Asegurado)
        rp.AddParametro(_DVRut_Asegurador)
        rp.AddParametro(_Nombre_Asegurado)
        rp.AddParametro(_ApellidoPaterno_Asegurado)
        rp.AddParametro(_ApellidoMaterno_Asegurado)
        rp.AddParametro(_FechaNacimiento_Asegurado)
        rp.AddParametro(_Sexo)
        rp.AddParametro(_Calle)
        rp.AddParametro(_NroCalle)
        rp.AddParametro(_NroDepartamento)
        rp.AddParametro(_VillaPoblacion)
        rp.AddParametro(_Telefono)
        rp.AddParametro(_Celular)
        rp.AddParametro(_Correo)
        rp.AddParametro(_CodCiudad)
        rp.AddParametro(_CodComuna)
        rp.AddParametro(_CodBanco)
        rp.AddParametro(_CodMedioPago)
        rp.AddParametro(_TipoTarjeta)
        rp.AddParametro(_NroMedioPago)
        rp.AddParametro(_FechaPrimerCargo)
        rp.AddParametro(_MedioPagoBCH)


        exec.ExecuteNonQuery(rp)
        exec.Commit()

        exec.Dispose()

    End Sub

    Public Sub Get_Planes(ByVal rp As NetResponse.MsSqlServer)
        Dim exec As New DotNetDAL.SqlServerTransaccion()
        rp.StoredProcedure = "sp_Get_Planes"

        rp.AddParametro(_iAnno)


        exec.Executedataset(rp)


        exec.Dispose()

    End Sub




#Region " IDisposable Support "

    Private disposedValue As Boolean = False        ' To detect redundant calls


    Protected Overridable Sub Dispose(ByVal disposing As Boolean)
        If Not Me.disposedValue Then
            If disposing Then
                ' TODO: free unmanaged resources when explicitly called
            End If

            ' TODO: free shared unmanaged resources
        End If
        Me.disposedValue = True
    End Sub

    ' This code added by Visual Basic to correctly implement the disposable pattern.
    Public Sub Dispose() Implements IDisposable.Dispose
        ' Do not change this code.  Put cleanup code in Dispose(ByVal disposing As Boolean) above.
        Dispose(True)
        GC.SuppressFinalize(Me)
    End Sub
#End Region
End Class
